home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / CIncludes / ADSP.h next >
Encoding:
C/C++ Source or Header  |  1992-01-29  |  7.6 KB  |  218 lines  |  [TEXT/MPS ]

  1.  
  2. /************************************************************
  3.  
  4. Created: Friday, September 13, 1991 at 10:23 AM
  5.  ADSP.h
  6.  C Interface to the Macintosh Libraries
  7.  
  8.  
  9.   Copyright Apple Computer, Inc. 1986-1991
  10.   All rights reserved
  11.  
  12. ************************************************************/
  13.  
  14.  
  15. #ifndef __ADSP__
  16. #define __ADSP__
  17.  
  18. #ifndef __APPLETALK__
  19. #include <AppleTalk.h>
  20. #endif
  21.  
  22.  
  23. enum {
  24.  
  25.  
  26. /* driver control ioResults */
  27.  errRefNum = -1280,                /* bad connection refNum */
  28.  errAborted = -1279,            /* control call was aborted */
  29.  errState = -1278,                /* bad connection state for this operation */
  30.  errOpening = -1277,            /* open connection request failed */
  31.  errAttention = -1276,            /* attention message too long */
  32.  errFwdReset = -1275,            /* read terminated by forward reset */
  33.  errDSPQueueSize = -1274,        /* DSP Read/Write Queue Too small */
  34.  errOpenDenied = -1273,            /* open connection request was denied */
  35.  
  36. /*driver control csCodes*/
  37.  dspInit = 255,                    /* create a new connection end */
  38.  dspRemove = 254,                /* remove a connection end */
  39.  dspOpen = 253,                    /* open a connection */
  40.  dspClose = 252,                /* close a connection */
  41.  dspCLInit = 251,                /* create a connection listener */
  42.  dspCLRemove = 250,                /* remove a connection listener */
  43.  dspCLListen = 249,                /* post a listener request */
  44.  dspCLDeny = 248,                /* deny an open connection request */
  45.  dspStatus = 247,                /* get status of connection end */
  46.  dspRead = 246,                    /* read data from the connection */
  47.  dspWrite = 245,                /* write data on the connection */
  48.  dspAttention = 244                /* send an attention message */
  49. };
  50. enum {
  51.  dspOptions = 243,                /* set connection end options */
  52.  dspReset = 242,                /* forward reset the connection */
  53.  dspNewCID = 241,                /* generate a cid for a connection end */
  54.  
  55. /* connection opening modes */
  56.  ocRequest = 1,                    /* request a connection with remote */
  57.  ocPassive = 2,                    /* wait for a connection request from remote */
  58.  ocAccept = 3,                    /* accept request as delivered by listener */
  59.  ocEstablish = 4,                /* consider connection to be open */
  60.  
  61. /* connection end states */
  62.  sListening = 1,                /* for connection listeners */
  63.  sPassive = 2,                    /* waiting for a connection request from remote */
  64.  sOpening = 3,                    /* requesting a connection with remote */
  65.  sOpen = 4,                        /* connection is open */
  66.  sClosing = 5,                    /* connection is being torn down */
  67.  sClosed = 6,                    /* connection end state is closed */
  68.  
  69. /* client event flags */
  70.  eClosed = 0x80,                /* received connection closed advice */
  71.  eTearDown = 0x40,                /* connection closed due to broken connection */
  72.  eAttention = 0x20,                /* received attention message */
  73.  eFwdReset = 0x10,                /* received forward reset advice */
  74.  
  75. /* miscellaneous constants */
  76.  attnBufSize = 570,                /* size of client attention buffer */
  77.  minDSPQueueSize = 100            /* Minimum size of receive or send Queue */
  78. };
  79.  
  80. /* connection control block */
  81. struct TRCCB {
  82.  unsigned char *ccbLink;        /* link to next ccb */
  83.  unsigned short refNum;            /* user reference number */
  84.  unsigned short state;            /* state of the connection end */
  85.  unsigned char userFlags;        /* flags for unsolicited connection events */
  86.  unsigned char localSocket;        /* socket number of this connection end */
  87.  AddrBlock remoteAddress;        /* internet address of remote end */
  88.  unsigned short attnCode;        /* attention code received */
  89.  unsigned short attnSize;        /* size of received attention data */
  90.  unsigned char *attnPtr;        /* ptr to received attention data */
  91.  unsigned char reserved[220];    /* for adsp internal use */
  92. };
  93.  
  94. typedef struct TRCCB TRCCB;
  95. typedef TRCCB *TPCCB;
  96.  
  97. /* init connection end parameters */
  98. struct TRinitParams {
  99.  TPCCB ccbPtr;                    /* pointer to connection control block */
  100.  ProcPtr userRoutine;            /* client routine to call on event */
  101.  unsigned short sendQSize;        /* size of send queue (0..64K bytes) */
  102.  unsigned char *sendQueue;        /* client passed send queue buffer */
  103.  unsigned short recvQSize;        /* size of receive queue (0..64K bytes) */
  104.  unsigned char *recvQueue;        /* client passed receive queue buffer */
  105.  unsigned char *attnPtr;        /* client passed receive attention buffer */
  106.  unsigned char localSocket;        /* local socket number */
  107. };
  108.  
  109. typedef struct TRinitParams TRinitParams;
  110.  
  111. /* open connection parameters */
  112. struct TRopenParams {
  113.  unsigned short localCID;        /* local connection id */
  114.  unsigned short remoteCID;        /* remote connection id */
  115.  AddrBlock remoteAddress;        /* address of remote end */
  116.  AddrBlock filterAddress;        /* address filter */
  117.  unsigned long sendSeq;            /* local send sequence number */
  118.  unsigned short sendWindow;        /* send window size */
  119.  unsigned long recvSeq;            /* receive sequence number */
  120.  unsigned long attnSendSeq;        /* attention send sequence number */
  121.  unsigned long attnRecvSeq;        /* attention receive sequence number */
  122.  unsigned char ocMode;            /* open connection mode */
  123.  unsigned char ocInterval;        /* open connection request retry interval */
  124.  unsigned char ocMaximum;        /* open connection request retry maximum */
  125. };
  126.  
  127. typedef struct TRopenParams TRopenParams;
  128.  
  129. /* close connection parameters */
  130. struct TRcloseParams {
  131.  unsigned char abort;            /* abort connection immediately if non-zero */
  132. };
  133.  
  134. typedef struct TRcloseParams TRcloseParams;
  135.  
  136. /* client status parameter block */
  137. struct TRstatusParams {
  138.  TPCCB ccbPtr;                    /* pointer to ccb */
  139.  unsigned short sendQPending;    /* pending bytes in send queue */
  140.  unsigned short sendQFree;        /* available buffer space in send queue */
  141.  unsigned short recvQPending;    /* pending bytes in receive queue */
  142.  unsigned short recvQFree;        /* available buffer space in receive queue */
  143. };
  144.  
  145. typedef struct TRstatusParams TRstatusParams;
  146.  
  147. /* read/write parameter block */
  148. struct TRioParams {
  149.  unsigned short reqCount;        /* requested number of bytes */
  150.  unsigned short actCount;        /* actual number of bytes */
  151.  unsigned char *dataPtr;        /* pointer to data buffer */
  152.  unsigned char eom;                /* indicates logical end of message */
  153.  unsigned char flush;            /* send data now */
  154. };
  155.  
  156. typedef struct TRioParams TRioParams;
  157.  
  158. /* attention parameter block */
  159. struct TRattnParams {
  160.  unsigned short attnCode;        /* client attention code */
  161.  unsigned short attnSize;        /* size of attention data */
  162.  unsigned char *attnData;        /* pointer to attention data */
  163.  unsigned char attnInterval;    /* retransmit timer in 10-tick intervals */
  164. };
  165.  
  166. typedef struct TRattnParams TRattnParams;
  167.  
  168. /* client send option parameter block */
  169. struct TRoptionParams {
  170.  unsigned short sendBlocking;    /* quantum for data packets */
  171.  unsigned char sendTimer;        /* send timer in 10-tick intervals */
  172.  unsigned char rtmtTimer;        /* retransmit timer in 10-tick intervals */
  173.  unsigned char badSeqMax;        /* threshold for sending retransmit advice */
  174.  unsigned char useCheckSum;        /* use ddp packet checksum */
  175. };
  176.  
  177. typedef struct TRoptionParams TRoptionParams;
  178.  
  179. /* new cid parameters */
  180. struct TRnewcidParams {
  181.  unsigned short newcid;            /* new connection id returned */
  182. };
  183.  
  184. typedef struct TRnewcidParams TRnewcidParams;
  185.  
  186. /* ADSP CntrlParam ioQElement , driver control call parameter block*/
  187. struct DSPParamBlock {
  188.  struct QElem *qLink;
  189.  short qType;
  190.  short ioTrap;
  191.  Ptr ioCmdAddr;
  192.  ProcPtr ioCompletion;
  193.  OSErr ioResult;
  194.  char *ioNamePtr;
  195.  short ioVRefNum;
  196.  short ioCRefNum;                /* adsp driver refNum */
  197.  short csCode;                    /* adsp driver control code */
  198.  long qStatus;                    /* adsp internal use */
  199.  short ccbRefNum;
  200.  union{
  201.   TRinitParams initParams;        /*dspInit, dspCLInit*/
  202.   TRopenParams openParams;        /*dspOpen, dspCLListen, dspCLDeny*/
  203.   TRcloseParams closeParams;    /*dspClose, dspRemove*/
  204.   TRioParams ioParams;            /*dspRead, dspWrite*/
  205.   TRattnParams attnParams;        /*dspAttention*/
  206.   TRstatusParams statusParams;    /*dspStatus*/
  207.   TRoptionParams optionParams;    /*dspOptions*/
  208.   TRnewcidParams newCIDParams;    /*dspNewCID*/
  209.   } u;
  210. };
  211.  
  212. typedef struct DSPParamBlock DSPParamBlock;
  213. typedef DSPParamBlock *DSPPBPtr;
  214.  
  215.  
  216.  
  217. #endif
  218.